<template>
  <div class="share">
    <!-- 标签中间的 {{ info.title }}不删除也行 因为v-html内容会把他覆盖-->
    <h3 class="title" v-html="info.title" @click="goInfo">{{ info.title }}</h3>
    <div class="txt van-multi-ellipsis--l2" @click="goInfo">
      {{ info.content }}
    </div>
    <div class="other">
      <img
        v-if="info.author.avatar"
        :src="baseURL + info.author.avatar"
        alt=""
        class="img"
      />
      <img v-else src="@/assets/logo.png" alt="" class="img" />
      <div class="username">{{ info.author.nickname }}</div>
      <div class="time">{{ info.updated_at | formatTime }}</div>
      <i class="iconfont o1">&#xe65b;</i>
      <p class="read">{{ info.read }}</p>
      <i class="iconfont o2">&#xe650;</i>
      <p class="good">{{ info.star }}</p>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      baseURL: process.env.VUE_APP_URL
    }
  },
  props: ['info'],
  methods: {
    goInfo () {
      this.$router.push(
        // 可以用这种
        // '/home/shareInfo?rePath=' + this.$route.fullPath + '&id=' + this.info.id
        // 可以用这种
        `/home/shareInfo/${this.info.id}?rePath=` + this.$route.fullPath
      )
    }
  }
}
</script>
<style lang="less" scoped>
.share {
  margin: 20px 0;
  .title {
    font-size: 16px;
    font-family: PingFangSC, PingFangSC-Medium;
    font-weight: 500;
    text-align: left;
    color: #181a39;
    line-height: 23px;
    letter-spacing: 0px;
  }
  .txt {
    font-size: 13px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: left;
    color: #545671;
    line-height: 19px;
    letter-spacing: 0px;
    margin: 15px 0;
  }
  .other {
    display: flex;
    align-items: center;
    .img {
      width: 22px;
      height: 22px;
      border-radius: 50%;
    }
    .username {
      flex: 1;
      padding-left: 10px;
      font-size: 12px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #545671;
      letter-spacing: 0px;
    }
    .time {
      font-size: 12px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #b4b4bd;
      letter-spacing: 0px;
    }
    .read {
      font-size: 12px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #b4b4bd;
      line-height: 17px;
      letter-spacing: 0px;
    }
    .good {
      font-size: 12px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #b4b4bd;
      line-height: 17px;
      letter-spacing: 0px;
    }
    .o1 {
      color: #c5c5cc;
      margin-left: 10px;
      margin-right: 5px;
    }
    .o2 {
      color: #c5c5cc;
      margin-left: 10px;
      margin-right: 5px;
    }
  }
}
</style>
